// --------------------------------------------------------------------------------------------
// Version: MPL 1.1/GPL 2.0/LGPL 2.1
// 
// The contents of this file are subject to the Mozilla Public License Version
// 1.1 (the "License"); you may not use this file except in compliance with
// the License. You may obtain a copy of the License at
// http://www.mozilla.org/MPL/
// 
// Software distributed under the License is distributed on an "AS IS" basis,
// WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
// for the specific language governing rights and limitations under the
// License.
// 
// <remarks>
// Generated by IDLImporter from file nsINSSErrorsService.idl
// 
// You should use these interfaces when you access the COM objects defined in the mentioned
// IDL/IDH file.
// </remarks>
// --------------------------------------------------------------------------------------------
namespace Gecko
{
	using System;
	using System.Runtime.InteropServices;
	using System.Runtime.InteropServices.ComTypes;
	using System.Runtime.CompilerServices;
	
	
	/// <summary>
    ///-*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
    ///
    /// This Source Code Form is subject to the terms of the Mozilla Public
    /// License, v. 2.0. If a copy of the MPL was not distributed with this
    /// file, You can obtain one at http://mozilla.org/MPL/2.0/. </summary>
	[ComImport()]
	[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
	[Guid("12f60021-e14b-4020-99d1-ed2c795be66a")]
	public interface nsINSSErrorsService
	{
		
		/// <summary>
        /// @param aNSPRCode An error code obtained using PR_GetError()
        /// @return True if it is error code defined by the NSS library
        /// </summary>
		[return: MarshalAs(UnmanagedType.U1)]
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		bool IsNSSErrorCode(int aNSPRCode);
		
		/// <summary>
        /// Function will fail if aNSPRCode is not an NSS error code.
        /// @param aNSPRCode An error code obtained using PR_GetError()
        /// @return The result of the conversion, an XPCOM error code
        /// </summary>
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		int GetXPCOMFromNSSError(int aNSPRCode);
		
		/// <summary>
        /// Function will fail if aXPCOMErrorCode is not an NSS error code.
        /// @param aXPCOMErrorCode An error code obtain using getXPCOMFromNSSError
        /// return A localized human readable error explanation.
        /// </summary>
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		void GetErrorMessage(int aXPCOMErrorCode, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalType = "Gecko.CustomMarshalers.AStringMarshaler")] nsAStringBase retval);
		
		/// <summary>
        /// Function will fail if aXPCOMErrorCode is not an NSS error code.
        /// @param aXPCOMErrorCode An error code obtain using getXPCOMFromNSSError
        /// return the
        /// </summary>
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		uint GetErrorClass(int aXPCOMErrorCode);
	}
	
	/// <summary>nsINSSErrorsServiceConsts </summary>
	public class nsINSSErrorsServiceConsts
	{
		
		// 
		public const ulong ERROR_CLASS_SSL_PROTOCOL = 1;
		
		// 
		public const ulong ERROR_CLASS_BAD_CERT = 2;
		
		// <summary>
        // The following values define the range of NSPR error codes used by NSS.
        // NSS remains the authorative source for these numbers, as a result,
        // the values might change in the future.
        // The security module will perform a runtime check and assertion
        // to ensure the values are in synch with NSS.
        // </summary>
		public const long NSS_SEC_ERROR_BASE = -(0x2000);
		
		// 
		public const long NSS_SEC_ERROR_LIMIT = (NSS_SEC_ERROR_BASE+1000);
		
		// 
		public const long NSS_SSL_ERROR_BASE = -(0x3000);
		
		// 
		public const long NSS_SSL_ERROR_LIMIT = (NSS_SSL_ERROR_BASE+1000);
		
		// <summary>
        // The error codes within each module must fit in 16 bits. We want these
        // errors to fit in the same module as the NSS errors but not overlap with
        // any of them. Converting an NSS SEC, NSS SSL, or mozilla::pkix error to
        // an NS error involves negating the value of the error and then
        // synthesizing an error in the NS_ERROR_MODULE_SECURITY module. Hence,
        // mozilla::pkix errors will start at a negative value that both doesn't
        // overlap with the current value ranges for NSS errors and that will fit
        // in 16 bits when negated.
        //
        // Keep these in sync with pkixnss.h.
        // </summary>
		public const long MOZILLA_PKIX_ERROR_BASE = -(0x4000);
		
		// 
		public const long MOZILLA_PKIX_ERROR_LIMIT = (MOZILLA_PKIX_ERROR_BASE+1000);
	}
}
